package Test;


import domain.Student1;

import java.util.ArrayList;
import java.util.Scanner;

public class Demo14 {
    public static void main(String[] args) {
        ArrayList<Student1> list = new ArrayList<>();
        /*method(list);
        method(list);
        method(list);*/
        Student1 stu = method();
        Student1 stu2 = method();
        Student1 stu3 = method();
        list.add(stu);
        list.add(stu2);
        list.add(stu3);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i).getName()+"..."+list.get(i).getAge());
        }
    }
    /*public static void method(ArrayList<Student1> list){
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        int age = sc.nextInt();
        Student1 stu = new Student1(name,age);
        list.add(stu);
    }*/

    public static Student1 method(){
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        int age = sc.nextInt();
        Student1 stu = new Student1(name ,age);
        return stu;
    }
}
